# $Id: PKGBUILD 77249 2012-10-08 05:50:32Z dwallace $
# Maintainer: Daniel Wallace <danielwallace at gtmanfred dot com>
# Contributor: Chris Brannon <cmbrannon79@gmail.com>
# Contributor: Geoffroy Carrier <geoffroy.carrier@aur.archlinux.org>
# Contributor: Richard Murri <admin@richardmurri.com>
pkgname=jython
pkgver=2.5.3
pkgrel=1
pkgdesc="An implementation of the Python language written in Java"
arch=('any')
url="http://www.jython.org/"
license=('PSF' 'APACHE' 'custom')
depends=('java-environment' 'bash' 'python')
backup=('opt/jython/registry')
options=('!emptydirs')
install='jython.install'
source=("http://search.maven.org/remotecontent?filepath=org/python/$pkgname-installer/$pkgver/$pkgname-installer-$pkgver.jar"
        'README.ArchLinux')

noextract=(${pkgname}_installer-${pkgver}.jar)

md5sums=('41633b4557483d6d4237ee79ffcebe7b'
         '0a2e265af61c7d695e13b605dc180553')

package() {
	cd "$srcdir"
	java -jar ${pkgname}-installer-${pkgver}.jar -s -t standard -d "$pkgdir"/opt/jython
	sed -i s*"${pkgdir}"**g "${pkgdir}"/opt/jython/jython

	# Get rid of hard-coded JAVA_HOME, since all the JDKs don't use
	# the same directory.
	sed -i '/^JAVA_HOME=.*$/d' "${pkgdir}"/opt/jython/jython

	install -m755 -D "$pkgdir/opt/jython/jython" "$pkgdir/usr/bin/jython"
	install -m644 -D "$srcdir/README.ArchLinux" "$pkgdir/usr/share/doc/$pkgname/README.ArchLinux"

	rm "$pkgdir/opt/jython/jython" "$pkgdir/opt/jython/bin/jython"
	install -m644 -D "$pkgdir/opt/jython/LICENSE.txt" "$pkgdir/usr/share/licenses/$pkgname/LICENSE.txt"
}
